package dev.hitools.common.widget.recyclerview.holder

import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView
import dev.hitools.common.BR

class BindHolder(val item: View) : RecyclerView.ViewHolder(item) {
    val binding: ViewDataBinding? = DataBindingUtil.bind(item)

    fun bind(variableId: Int, data: Any?, position: Int) {
        binding?.setVariable(BR.position, position)
        binding?.setVariable(variableId, data)
        binding?.executePendingBindings()
    }
}